using System.Runtime.InteropServices;
using Avalonia.WebView.Windows;
#if LINUX
using Avalonia.WebView.Linux;
#endif
#if OSX
using Avalonia.WebView.MacCatalyst;
#endif

namespace Avalonia.WebView.Desktop;

public static class AppBuilderExtensions
{
    public static AppBuilder UseDesktopWebView(this AppBuilder builder, bool isWslDevelop = false)
    {
        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            builder.UseWindowWebView();
        else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
        {
#if OSX
            builder.UseMacCatalystWebView();
#endif
        }
        else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
        {
#if LINUX
            builder.UseLinuxWebView(isWslDevelop);
#endif
        }

        return builder;
    }
}
